package self.niu.com.resume.db.dao.impl;

import com.lidroid.xutils.DbUtils;
import com.lidroid.xutils.exception.DbException;

import java.util.List;

import self.niu.com.resume.AppBase;
import self.niu.com.resume.db.JavaAbility;
import self.niu.com.resume.db.User;
import self.niu.com.resume.db.dao.JavaAbilityDao;

/**
 * Created by Administrator on 2015/9/27 0027.
 */
public class JavaAblilityDaoImpl implements JavaAbilityDao {
    public DbUtils db;

    public JavaAblilityDaoImpl() {
        this.db = AppBase.db;
    }

    @Override
    public void update(JavaAbility java, String numberCusor) {
        try {
            db.update(java, numberCusor);
        } catch (DbException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void save(JavaAbility java) {
        try {
            db.save(java);
        } catch (DbException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void deleteById(int id) {

    }

    @Override
    public JavaAbility find(String name) {
        return null;
    }

    @Override
    public List<JavaAbility> findAll() {
        List<JavaAbility> java = null;
        try {
            java = db.findAll(JavaAbility.class);
        } catch (DbException e) {
            e.printStackTrace();
        }
        return java;
    }


    @Override
    public void createDb(Class t) {
        try {
            db.createTableIfNotExist(t);
        } catch (DbException e) {
            e.printStackTrace();
        }
    }
}
